using System;
using System.Diagnostics.Contracts;

namespace OpenWaves.ActivityFeed.Web
{
    public class UserDto
    {
#if NET_40_OR_GREATER
        public dynamic Profile { get; set; }
#else
        public object Profile { get; set; }
#endif
        public string Id { get; set; }

        public static UserDto FromUserId(string userId, IUserProfileProvider userProfileProvider)
        {
            Contract.Requires<ArgumentNullException>(String.IsNullOrEmpty(userId) == false);
            Contract.Requires<ArgumentNullException>(userProfileProvider != null);

            var userProfile = userProfileProvider.GetUserProfile(userId);
            Contract.Assert(userProfile != null);

            var result = new UserDto()
                             {
                                 Id = userId,
                                 Profile = userProfile
                             };

            return result;
        }
    }
}    